UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HI9w3L1jjbHx3+OcZGP/vyetiAsxyDZW8ofGzandnXc=' 
WHERE 
  key_id = '0b8d2b4cd839653f8d705b721f89acbd8b9d877301106a24af4ddc2aabc6f97d' 
  AND (
    token = 'HI9w3L1jjbHx3+OcZGP/vyetiAsxyDZW8ofGzandnXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033