UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HOyi7FjvkQMp2BD+OSWTRDxTBr9wm0Vzv9MCn5pg3MQ=' 
WHERE 
  key_id = '5626d398e6fa31b7ccd7817e97297711f8d76e8d5fd62e4a757ac579c30fc4d0' 
  AND (
    token = 'HOyi7FjvkQMp2BD+OSWTRDxTBr9wm0Vzv9MCn5pg3MQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046