UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yV+JscDrL5ZKZonrL6oIEVesYwajG6694UspHgfqq0w=' 
WHERE 
  key_id = '637a09b457ec0260b9da71abf552ec1bd940dd5da1cfe55027dc382b19d8df41' 
  AND (
    token = 'yV+JscDrL5ZKZonrL6oIEVesYwajG6694UspHgfqq0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022