UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8RjIn07i6rTDTqG5fONKAuU/2N9ewTHYOcIynP3DWIo=' 
WHERE 
  key_id = '535863b70ca9ca0eb400c81c95809da51b6e36920d883421c193f61523607685' 
  AND (
    token = '8RjIn07i6rTDTqG5fONKAuU/2N9ewTHYOcIynP3DWIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044