UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x35I5tSeg/d5etVw2QZPbOEGMlZWVGxwdBxZhOu+b/8=' 
WHERE 
  key_id = '510f83bafa8371ce99299685157782c3dd44b9bc533a2c467f5ab8e3feaeac6e' 
  AND (
    token = 'x35I5tSeg/d5etVw2QZPbOEGMlZWVGxwdBxZhOu+b/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032