UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T/WUOd5pXTNz+9SygTgFW3lqMN6iWY8pNwoXGu/ovBQ=' 
WHERE 
  key_id = 'a9048d6f717d1a742e6ca0c646e9edd2f90fc419390f652bd5d1b5181f40023b' 
  AND (
    token = 'T/WUOd5pXTNz+9SygTgFW3lqMN6iWY8pNwoXGu/ovBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046