UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r35NDd/fOKIkcnJBmhq8hYigEzC/9jx0ULT0iluFLp8=' 
WHERE 
  key_id = '883c3f139b2954db520544c15174af33b2bedeb0946d15e7f5d9100ca804233b' 
  AND (
    token = 'r35NDd/fOKIkcnJBmhq8hYigEzC/9jx0ULT0iluFLp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017