UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z/ycDeZO1XbhQWvmlBKyv/g7mVDRfDG5AoxoZSL9e9o=' 
WHERE 
  key_id = 'cd386227cfbebc67c53cdc875c563273b7719df7921de916f695ee01267acc00' 
  AND (
    token = 'Z/ycDeZO1XbhQWvmlBKyv/g7mVDRfDG5AoxoZSL9e9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040