UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1fukitUfzOKVXoBQKxvDaBQV9Lw8k0WVrrV7E/MCDYU=' 
WHERE 
  key_id = 'bd4abec6a9dbc0a8b508e9974986f391f1e51955d0f9e20b7a47366e9cbda2d0' 
  AND (
    token = '1fukitUfzOKVXoBQKxvDaBQV9Lw8k0WVrrV7E/MCDYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035