UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2oXrnzGSmYUsicQCQgjtioL4O0HI5gSczFCBB4RYapI=' 
WHERE 
  key_id = 'f58ca36aa5074f92679bee56cbf63cfa24c63fa978c42c3d98497070a3f92541' 
  AND (
    token = '2oXrnzGSmYUsicQCQgjtioL4O0HI5gSczFCBB4RYapI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028