UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CMehHWkPuST9qsKhzPxENVOHzg4UcJ8VdrjOFy1rnTc=' 
WHERE 
  key_id = 'b819a2a4e0f06ad843624afc183337e9b4482a92bf4e2c3efb0f457217b03edf' 
  AND (
    token = 'CMehHWkPuST9qsKhzPxENVOHzg4UcJ8VdrjOFy1rnTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038