UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awxmK2ZucELdO0TmiXKGoUik/4VFltSB07jwl8D65oU=' 
WHERE 
  key_id = '781d8040b7d799f42a7a4e5c616d80f236ee1a3b2bbf54feb3a71491d6b9cbb1' 
  AND (
    token = 'awxmK2ZucELdO0TmiXKGoUik/4VFltSB07jwl8D65oU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028