UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'njUFYVhCfaj0/koXEMPQ+yt6f/LS0TsrtiJO1Q/l32U=' 
WHERE 
  key_id = 'c9ccf04936e56c96a21d6245ac15f4ac1f48427695c42ccad56bb4a56ae7fe8e' 
  AND (
    token = 'njUFYVhCfaj0/koXEMPQ+yt6f/LS0TsrtiJO1Q/l32U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022