UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SBRX9aDZ+vFCXKy6CfDWotEjFARz0Biyr4pfhe2Qhvo=' 
WHERE 
  key_id = '78664f65975079b3e2377df0711b382a26e5a1aa560626e1926d0598890476fd' 
  AND (
    token = 'SBRX9aDZ+vFCXKy6CfDWotEjFARz0Biyr4pfhe2Qhvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033