UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h6lPPGC9Cz9C8FwCXw0X+fx7Du7YOww/veFg8BH2BG4=' 
WHERE 
  key_id = '1bd5187d07a8211e42e0876947c20670dd834c752927a701fe7f8eb3ca2c164e' 
  AND (
    token = 'h6lPPGC9Cz9C8FwCXw0X+fx7Du7YOww/veFg8BH2BG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020