UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FpKwmigxpXqTi9u48emBzCosnxbgo//6NBwrDPFBCls=' 
WHERE 
  key_id = 'd8a4bf7e3625d208d3df6a393335f9eeee2388022a4c8ed887aac29328d72a88' 
  AND (
    token = 'FpKwmigxpXqTi9u48emBzCosnxbgo//6NBwrDPFBCls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030