UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lFhw1Lfywv9++CbvrxCPmxDZVX8mUmMG9cHXNew8Ayw=' 
WHERE 
  key_id = '542924318e5a3d43813b9506582d1eb613ef3eae8206e0a1cd7c2be9be834f77' 
  AND (
    token = 'lFhw1Lfywv9++CbvrxCPmxDZVX8mUmMG9cHXNew8Ayw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037