UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'My9wx1BZcuUyVJRjl3S7YiniCU+ZrgL7SH9RYAY5pc4=' 
WHERE 
  key_id = '0588a4c932120ced2f16b5d4102e6c2c9d12aef400432fd172c9ec60b868c820' 
  AND (
    token = 'My9wx1BZcuUyVJRjl3S7YiniCU+ZrgL7SH9RYAY5pc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019