UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3YsqpT3Na6V6s856x9nm0lApMdAniEmEJJ6ALzBWdyg=' 
WHERE 
  key_id = '084d1035224e5b20cbf8760b0bbdc7fa867df32696e26951b87e547e5441554d' 
  AND (
    token = '3YsqpT3Na6V6s856x9nm0lApMdAniEmEJJ6ALzBWdyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029