UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJoF1OujCF9+sMfNQYgJ9/mD9a1Ar8bxx6zHUzWi7C0=' 
WHERE 
  key_id = '7e1f623151d5c801f75308f380668a6bfd7957dc0b5f0803649ac667373d74f8' 
  AND (
    token = 'IJoF1OujCF9+sMfNQYgJ9/mD9a1Ar8bxx6zHUzWi7C0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035