UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4G32Y26HdkE63YE2TeOgvvOmScyBjaIv6FrinQpcBcY=' 
WHERE 
  key_id = '6334f24a4c2aba55a5a8571f841be35e6cddd62c769c0540e81a0b3c5d7bf0ce' 
  AND (
    token = '4G32Y26HdkE63YE2TeOgvvOmScyBjaIv6FrinQpcBcY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032