UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5NcMpM8Z84IME+7iKvCRcmntSvJJvbU19wPR8zX/ozM=' 
WHERE 
  key_id = 'f1474a882eb627a2d3dd3e05205849da5673a1ff5f041ea931a20c88e50a1a8f' 
  AND (
    token = '5NcMpM8Z84IME+7iKvCRcmntSvJJvbU19wPR8zX/ozM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027