UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I720yzIZ1Ula9DzXZRB56pD5jG7SGv6AhmYQsjO5vuc=' 
WHERE 
  key_id = 'a591d1414f97ba7d54603e82dcf0e7b2bdba6def68d64f148932528451fc391a' 
  AND (
    token = 'I720yzIZ1Ula9DzXZRB56pD5jG7SGv6AhmYQsjO5vuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041