UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vAo3O4WvRUEdF9f69TvUjCT5VEACEuU7hWuUo+6KAEA=' 
WHERE 
  key_id = 'c45a80760a409795be131dbb4285d3b001da85c39e377aee14b38b7375cdd861' 
  AND (
    token = 'vAo3O4WvRUEdF9f69TvUjCT5VEACEuU7hWuUo+6KAEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040