UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qxChjL8HT2ek8yS4zA2iQzPiQafY+KAjsdAL27/Jofs=' 
WHERE 
  key_id = '2a87a239af83aa5d12d9a4067646f89c54cad27284f53b4f5a45889ab3a03318' 
  AND (
    token = 'qxChjL8HT2ek8yS4zA2iQzPiQafY+KAjsdAL27/Jofs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042