UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'thckiUzNkV2oupeDo1KEvbJTgg6TEEhsEKK7wZeAfuM=' 
WHERE 
  key_id = '830f6cf9a08adb41ff203074fff130505debf9c7adc474c5bbc9481274fa1e5a' 
  AND (
    token = 'thckiUzNkV2oupeDo1KEvbJTgg6TEEhsEKK7wZeAfuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040