UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cO9dtpau6nBc+7ReKKJmfbtCVdeQfWGE2IyIJNslwu8=' 
WHERE 
  key_id = '5066a1ae501aef2c5e30c70e0fa9e6e90b3e405458544885c861e32904ebc053' 
  AND (
    token = 'cO9dtpau6nBc+7ReKKJmfbtCVdeQfWGE2IyIJNslwu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022