UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vi7Y3nzAV0o9Pg5eu0/b5KxO86cqv6zRuviUy2v6RsY=' 
WHERE 
  key_id = 'ca403bfc08cda690756d558e7fb864b701e5eb6a1e2f4364d95f77ac30fac2b6' 
  AND (
    token = 'vi7Y3nzAV0o9Pg5eu0/b5KxO86cqv6zRuviUy2v6RsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032