UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NGVA2OEBzIT+AfgzgcY4B2h5jUQAjIRuhwT6ZP9nzTI=' 
WHERE 
  key_id = '7027b261ce0898cde261c8b5ee0b2993d606c1cb4e377432d31cf6b03bec2408' 
  AND (
    token = 'NGVA2OEBzIT+AfgzgcY4B2h5jUQAjIRuhwT6ZP9nzTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034