UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S9+Eezysm84INJDE/Rdi1quFgK5otlq8e8FZmGY7e70=' 
WHERE 
  key_id = '944072820699fea12fa2a7c79e355e12120d328377f428279dd75030f6f330c9' 
  AND (
    token = 'S9+Eezysm84INJDE/Rdi1quFgK5otlq8e8FZmGY7e70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00112