UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Suaandfi3qMWQrkmyEbKOtK1BEJECFClNTOfDzo4l8=' 
WHERE 
  key_id = '9f10ce517c11c9ed185681a21898fc79f7d9fca91b90afe023c011ea777f6cec' 
  AND (
    token = '8Suaandfi3qMWQrkmyEbKOtK1BEJECFClNTOfDzo4l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043