UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MOgc3v2vL+tqoBRiTgXK0CHpUcoNm+2oBxwRs35VHU8=' 
WHERE 
  key_id = '8355479bd8e551368b4fb97e7e4d068f13cb31669df636bd584bc30afd76744c' 
  AND (
    token = 'MOgc3v2vL+tqoBRiTgXK0CHpUcoNm+2oBxwRs35VHU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049